package cn.bs.db.cfg;

import org.hibernate.cfg.ImprovedNamingStrategy;
import org.hibernate.cfg.NamingStrategy;
import org.springframework.stereotype.Component;

@Component("customNamingStrategy")
public class CustomNamingStrategy extends ImprovedNamingStrategy implements NamingStrategy {
    /**
     * 自定义字段名(字段名为属性名按照不同单词以下划线规则分割规则生成)
     */
    @Override
    public String propertyToColumnName(String propertyName) {
        return addUnderscores(propertyName).toUpperCase();
    }
}
